using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class PackProductsDAL : SqlDataProvider	{		#region[PackProducts_GetById]		public List<PackProducts> PackProducts_GetById(string Id)		{			List<Data.PackProducts> list = new List<Data.PackProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_GetById", GetConnection()))			{				Data.PackProducts obj = new Data.PackProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PackProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[PackProducts_GetByTop]		public List<PackProducts> PackProducts_GetByTop(string Top, string Where, string Order)		{			List<Data.PackProducts> list = new List<Data.PackProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_GetByTop", GetConnection()))			{				Data.PackProducts obj = new Data.PackProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PackProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[PackProducts_GetByAll]		public List<PackProducts> PackProducts_GetByAll(string Lang)		{			List<Data.PackProducts> list = new List<Data.PackProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_GetByAll", GetConnection()))			{				Data.PackProducts obj = new Data.PackProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PackProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[PackProducts_Paging]		public List<PackProducts> PackProducts_Paging(string CurentPage, string PageSize, string Lang)		{			List<Data.PackProducts> list = new List<Data.PackProducts>();			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_Paging", GetConnection()))			{				Data.PackProducts obj = new Data.PackProducts();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.PackProductsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		return list;		}		#endregion		#region[PackProducts_Insert]		public bool PackProducts_Insert(PackProducts data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@ProductsId", data.ProductsId == "" || data.ProductsId == "0" ? DBNull.Value : (object)data.ProductsId));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Price", data.Price));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("PackProducts");			return true;		}		#endregion		#region[PackProducts_Update]		public bool PackProducts_Update(PackProducts data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_Update", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@ProductsId", data.ProductsId == "" || data.ProductsId == "0" ? DBNull.Value : (object)data.ProductsId));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Price", data.Price));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("PackProducts");			return true;		}		#endregion		#region[PackProducts_Delete]		public bool PackProducts_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_PackProducts_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("PackProducts");			return true;		}		#endregion			}}